<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性写的案例</title>
</head>
<body>
  <div id="root">
      <input type="text" v-model="firstname"><br>
      <input type="text" v-model="lastname"><br>
      <input type="text" :value="fullname"><br>
  </div>


<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
<script>

    new Vue({
        el:'#root',
        data:{
            firstname: '',
            lastname:''
        },


        /*
        *  computed属性要通过v-model拿到变化的最新值
        * */
        computed:{
            fullname(){
                return this.firstname+ '->' +this.lastname
            }
        }
    })


</script>
</body>
</html>